Skip to content

fix(forms): return pending form handoffs as non-error results - #3896

Open
Shanmukh-l33t wants to merge 1 commit into
github:mainfrom
Shanmukh-l33t:fix-3666
Open

Shanmukh-l33t wants to merge 1 commit into
github:mainfrom
Shanmukh-l33t:fix-3666

Conversation

@Shanmukh-l33t

Copy link
Copy Markdown

Summary

Deferred form handoffs for create_pull_request, update_pull_request, and issue_write were returned with IsError: true. Hosts treat error results as failed tool calls and exclude them from MCP App rendering, so users never saw the form. This is the server side blocker described in #3666.

  • utils.NewToolResultAwaitingFormSubmission now returns a non-error result. The pending state stays explicit in the stop message and in structuredContent as status: "awaiting_user_submission" plus its reason.
  • The deferral paths preserve handler content so modern clients keep the stop message in text instead of replacing it with the structured JSON.
  • The form deferral feature flag is unchanged.

Testing

  • New unit test TestNewToolResultAwaitingFormSubmissionIsNotAnError fails on the old helper (Should be false) and passes after the change.
  • Existing deferral tests flipped to assert the non-error result and still verify the message and structured status: TestTypedIssueWriteAwaitingForm, TestTypedPullRequestWriteAwaitingForm, Test_IssueWrite_MCPAppsFeature_UIGate, Test_CreatePullRequest_MCPAppsFeature_UIGate, Test_UpdatePullRequest_MCPAppsFeature_UIGate.
  • go build ./..., go vet ./..., golangci-lint run ./pkg/utils/... ./pkg/github/... all clean.
  • go test ./... -p 2 passed.

Scope

This changes the result contract only. It does not alter when deferral happens, the form contents, or the submission path. Hosts still need to render and deliver the form, and genuinely failed tool calls still return isError: true.

Fixes #3666

Prepared with AI assistance and verified by the author.

Hosts treat isError results as failed tool calls and exclude them from
MCP App rendering, so the deferred create_pull_request, update_pull_request,
and issue_write forms never appeared. The pending handoff is now a normal
result that keeps its stop message and awaiting_user_submission status.
Handler content is preserved so modern clients keep the stop message in
text instead of replacing it with the structured JSON.
@Shanmukh-l33t
Shanmukh-l33t requested a review from a team as a code owner November 19, 2026 11:13
Copilot AI adaptive review requested due to automatic review settings November 19, 2026 11:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The pending-write success/error contract spans middleware, host rendering, and agent continuation, requiring human validation of the handoff and final-result lifecycle beyond server-side assertions.

No open issues 🎉

What changed in this PR

This PR addresses the server-side form-rendering blocker in #3666 by returning pending MCP App form handoffs as non-error results. It preserves explicit pending status and stop messages without changing when forms are shown or how submissions execute.

Changes:

  • Return non-error handoffs for issue creation/updates and pull request creation/updates.
  • Preserve handler text so modern clients retain the stop message alongside structured pending status.
  • Update regression tests and error-handling documentation for the revised contract.
File Description
pkg/​utils/​result.go Return pending form handoffs with IsError: false.
pkg/​utils/​result_test.go Add coverage for non-error handoffs, text, and pending status.
pkg/​github/​typed_consolidated_pull_request_outputs_test.go Assert non-error pull request handoffs and preserved text.
pkg/​github/​typed_consolidated_issue_outputs_test.go Assert non-error issue handoffs and preserved text.
pkg/​github/​pullrequests.go Preserve handler text when deferring pull request writes.
pkg/​github/​pullrequests_test.go Update form-routing assertions and explanatory comments.
pkg/​github/​issues.go Preserve deferred issue-write text and clarify the result contract.
pkg/​github/​issues_test.go Expect non-error results across issue form-routing cases.
docs/​error-handling.md Document pending forms as non-error results, not completed mutations.

Review effort: Balanced (adaptive)

@IrynaKulakova IrynaKulakova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pending-form handoff retains its explicit awaiting-submission status and stop message while returning a non-error result, allowing MCP App rendering. Focused issue and PR handoff tests pass. Approval is based on server-side behavior; live Codex rendering and submission remain unverified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Apps: isError form deferral suppresses PR forms in Codex desktop

3 participants